package com.cci.kangdao.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cci.kangdao.aop.annotation.NoDuplicateSubmission;
import com.cci.kangdao.service.ConfirmationByServiceManagerService;
import com.cci.kangdao.utilTool.ParameterTool;

@Controller
public class ConfirmationByServiceManagerController {

	/**
	 * 区域服务经理改派接口
	 * 
	 */
	private Logger log = Logger.getLogger(this.getClass().getName());
	
	@Autowired
	private ConfirmationByServiceManagerService confirmationByServiceManagerService;

    @NoDuplicateSubmission
    @RequestMapping("/ConfirmationByServiceManager.aspx")
    public ModelAndView getAllServiceStation(HttpServletRequest request, HttpServletResponse response) {
        try{
            Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
            map.put("response", response);
            map.put("request", request);
            return confirmationByServiceManagerService.affirmNew(map);
        }catch(Exception ex){
            log.error(ex.getMessage(),ex);
            String msg = "{\"status\": -99,\"msg\": \"未知错误\"}";
            ParameterTool.writeResponse(response, msg);
        }
        return null;
    }


    
    /**
     * 商务处主任改派服务站
     */
    @NoDuplicateSubmission
    @RequestMapping("/businessDirectorDispatchStation.aspx")
    public ModelAndView businessDirectorDispatchStation(HttpServletRequest request, HttpServletResponse response) {
        try{
            Map<String, Object> map = ParameterTool.getParameterRequest(request, true);
            map.put("response", response);
            map.put("request", request);
            return confirmationByServiceManagerService.affirm(map);
        }catch(Exception ex){
            log.error(ex.getMessage(),ex);
            ParameterTool.writeErrorResponse(response);
        }
        return null;
    }
}
